% Load data for analysis

load('max_growthrate_arrays.mat');
load('activation_energies.mat');
clc;
close all;
%% Plot correlations between grmax and Ea

% Load max growth rates at 37 °C
grmax37_allconc_glucose = grmax_tot_glucose(:,3);
grmax37_allconc_glucose_err = grmax_err_tot_glucose(:,3);

grmax37_allconc_fructose = grmax_tot_fructose(:,3);
grmax37_allconc_fructose_err = grmax_err_tot_fructose(:,3);

grmax37_allconc_succinate = grmax_tot_succinate(:,3);
grmax37_allconc_succinate_err = grmax_err_tot_succinate(:,3);

grmax37_allconc_maltose = grmax_tot_maltose(:,3);
grmax37_allconc_maltose_err = grmax_err_tot_maltose(:,3);

grmax37_allconc_proline = grmax_tot_proline(:,3);
grmax37_allconc_proline_err = grmax_err_tot_proline(:,3);

% Now do plotting

figure;
errorbar(Ea_glucose, grmax37_allconc_glucose, grmax37_allconc_glucose_err, 'bo-', 'linewidth', 1);
hold on;

errorbar(Ea_fructose, grmax37_allconc_fructose, grmax37_allconc_fructose_err, 'ko-', 'linewidth', 1);

errorbar(Ea_succinate, grmax37_allconc_succinate, grmax37_allconc_succinate_err, 'mo-', 'linewidth', 1);

errorbar(Ea_maltose, grmax37_allconc_maltose, grmax37_allconc_maltose_err, 'ro-', 'linewidth', 1);

errorbar(Ea_proline, grmax37_allconc_proline, grmax37_allconc_proline_err, 'go-', 'linewidth', 1);

set(gcf, 'Position', [0 0 400 300]);
set(gca, 'fontsize', 20);
box off;
xlabel('Activation energy (k_BT)');
ylabel('Max growth rate at 37 °C (1/h)');
legend 'Glucose' 'Fructose' 'Succinate' 'Maltose' 'Proline'
xlim([15 50]);
%% Plot only kcat data
k = 1; % Use max concentration


figure;
errorbar(Ea_glucose(k), grmax37_allconc_glucose(k), grmax37_allconc_glucose_err(k), 'bo-', 'linewidth', 1);
hold on;

errorbar(Ea_fructose(k), grmax37_allconc_fructose(k), grmax37_allconc_fructose_err(k), 'ko-', 'linewidth', 1);

errorbar(Ea_succinate(k), grmax37_allconc_succinate(k), grmax37_allconc_succinate_err(k), 'mo-', 'linewidth', 1);

errorbar(Ea_maltose(k), grmax37_allconc_maltose(k), grmax37_allconc_maltose_err(k), 'ro-', 'linewidth', 1);

errorbar(Ea_proline(k), grmax37_allconc_proline(k), grmax37_allconc_proline_err(k), 'go-', 'linewidth', 1);

set(gcf, 'Position', [0 0 400 300]);
set(gca, 'fontsize', 20);
box off;
xlabel('Activation energy (k_BT)');
ylabel('Max growth rate at 37 °C (1/h)');
legend 'Glucose' 'Fructose' 'Succinate' 'Maltose' 'Proline'
xlim([15 50]);


